package com.hong.demo.utils;

import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;

public class FastJsonUtil {

    // 生成json
    public static String getJson(Object obj) {
        return JSONObject.toJSONString(obj);
    }

    // 去掉null值，生成json
    public static String getJsonNotNull(Object obj) {
        return JSONObject.toJSONString(obj, SerializerFeature.WriteMapNullValue);
    }
}